/**
 * Created :Mar 26, 2012
 *
 * @author pquiring
 */

import java.awt.*;

public class ViewApp extends javax.swing.JFrame {

  /**
   * Creates new form ViewApp
   */
  public ViewApp() {
    initComponents();
    This = this;
    String file = javaforce.JF.getCurrentPath();
    if (args.length > 0) file = args[0];
    this.setExtendedState(MAXIMIZED_BOTH);
    setVisible(true);
    MainPanel panel = new MainPanel();
    setContentPane(panel);
    panel.showImage(file);
  }

  /**
   * This method is called from within the constructor to initialize the form.
   * WARNING: Do NOT modify this code. The content of this method is always
   * regenerated by the Form Editor.
   */
  @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("jView");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 165, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 125, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

  /**
   * @param args the command line arguments
   */
  public static void main(String args[]) {
    ViewApp.args = args;
    /*
     * Create and display the form
     */
    java.awt.EventQueue.invokeLater(new Runnable() {
      public void run() {
        new ViewApp();
      }
    });
  }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    // End of variables declaration//GEN-END:variables

  public static ViewApp This;
  private static String args[];
  public static void setFrameSize(Dimension size, int toolbarHeight) {
    Insets insets = This.getInsets();
    size.width += insets.left + insets.right + 64;
    size.height += insets.top + insets.bottom + 64;
    size.height += toolbarHeight;
    This.setSize(size);
  }
}
